package com.human.controller;


import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.human.entity.Appraise;
import com.human.entity.ResultVo;
import com.human.service.IAppraiseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 评估 前端控制器
 * </p>
 *
 * @author jzq
 * @since 2023-03-09
 */
@RestController
@RequestMapping("/api/appraise")
@Api(tags = "评估管理")
@ApiSupport(order = 7)
public class AppraiseController {

    @Autowired
    IAppraiseService appraiseService;

    @PostMapping("/page")
    @ApiOperation(value = "分页查询")
    public ResultVo page(int current, int pageSize, String name) {
        return appraiseService.page(current, pageSize, name);
    }

    @GetMapping("/appraiseList")
    @ApiOperation(value = "查询所有评估")
    public ResultVo getAllAppraises() {
        return appraiseService.getAllAppraises();
    }

    @GetMapping("/{id}")
    @ApiOperation(value = "根据ID查询评估")
    public ResultVo getAppraiseById(@PathVariable("id") Integer id) {
        return appraiseService.getAppraiseById(id);
    }

    @PutMapping("/updateAppraise")
    @ApiOperation(value = "修改评估")
    public ResultVo updateAppraise(@RequestBody Appraise appraise) {
        return appraiseService.updateAppraise(appraise);
    }

    @PostMapping("/addAppraise")
    @ApiOperation(value = "添加评估")
    public ResultVo addAppraise(@RequestBody Appraise appraise) {
        return appraiseService.addAppraise(appraise);
    }

    @DeleteMapping("/{id}")
    @ApiOperation(value = "删除评估")
    public ResultVo deleteAppraiseById(@PathVariable("id") Integer id) {
        return appraiseService.deleteAppraiseById(id);
    }

}

